package com.heima.feign;

import com.heima.common.dtos.FindNewsCommentsDto;
import com.heima.common.dtos.PageResult;
import com.heima.model.article.dtos.ArticleDto;
import com.heima.model.article.dtos.AuthorDto;
import com.heima.model.media.dtos.WmNewsResultDTO;
import io.swagger.models.auth.In;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("leadnews-article")
public interface ArticleFeign {

    @PostMapping("/api/v1/author/save")
    Integer createAuthor(@RequestBody  AuthorDto authorDto);

    @PostMapping("/api/v1/article/save")
    Long createArticle(@RequestBody WmNewsResultDTO dto);

    @GetMapping("/api/v1/article/findByPage")
    List<ArticleDto> findByPage(@RequestParam("page") int page, @RequestParam("size")int size);

    @GetMapping("/api/v1/article/findById")
    ArticleDto findById(@RequestParam("articleId") long articleId);

    @PostMapping("/api/v1/comment/manage/find_news_comments")
    PageResult findNewsComments(@RequestBody FindNewsCommentsDto dto);
}
